<# # It is recommended to test the script on a local machine for its purpose and effects. # Endpoint Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description: Script to check if multiple files exist under a given directory path. # Configuration Type - Computer / User # Arguments "C:\Path\To\File1.txt" "D:\Path\To\File2.docx" "E:\Path\To\File3.pdf" # Note: Based on the provided path (User Based / Computer Based), the operation can be triggered for either the computer or the user, but both actions cannot be performed simultaneously. #> # Get all arguments passed to the script $filesToCheck = $args # Check if any arguments are passed if ($filesToCheck.Length -eq 0) { Write-Host "No file paths provided." exit } # Loop through each file and check if it exists foreach ($filePath in $filesToCheck) { if (Test-Path -Path $filePath -PathType Leaf) { Write-Host "File '$filePath' exists." } else { Write-Host "File '$filePath' does not exist." } }